package com.yutel.collection;

import java.util.LinkedList;
import java.util.Queue;
import java.util.Stack;

public class TestFIFO {
	public static void main(String[] args) {
//		queue();
		stack();
	}

	public static void queue() {
		Queue<Integer> list = new LinkedList<Integer>();
		for (int i = 0; i < 20; i++) {
			list.offer(i);
		}
		for (Integer i : list) {
			System.out.println(i);
		}
		System.out.println("--------------");
		while (!list.isEmpty()) {
			System.out.println(list.poll());
		}
	}

	public static void stack() {
		Stack<Integer> list = new Stack<Integer>();
		for (int i = 0; i < 20; i++) {
			list.push(i);
		}
		for (Integer i : list) {
			System.out.println(i);
		}
		System.out.println("--------------");
		while (!list.isEmpty()) {
			System.out.println(list.pop());
		}
	}

}
